#include "substitution_matrix.h"

#include <assert.h>
#include <stdio.h>

int main (void) {

  short a,b,c;

  // Test 1:  d(a,b) = d(b,a); Test 2: d(a,b) >= 0

  for(a = 0; a < 25; a++) {
    for(b = 0; b < 25; b++) {
      double ab = substitution_matrix_distance(a,b);
      double ba = substitution_matrix_distance(b,a);

      assert(ab >= 0.0);
      assert(ab == ba);

    }
  }
  printf("Tests 1,2 passed!\n");
  fflush(stdout);
  
  // Test 3 triangle inequality.

  for(a = 0; a < 25; a++) {
    for(b = 0; b < 25; b++) {
      for(c = 0; c < 25; c++) {
	double ab = substitution_matrix_distance(a,b);
	double bc = substitution_matrix_distance(b,c);
	double ac = substitution_matrix_distance(a,c);
	
	assert(ac <= (ab+bc));
      }
    }
  }
  
  printf("Test 3 passed!\n");
  
  return 0;
}
